

 <script>
	  //插入html内容到template编辑框
	  function insertHtml(html){
		  UE.getEditor('template').execCommand('insertHtml', html);
	  }
  	//通过弹出窗口的形式打开添加字段信息页面
	function openupedit(url){
		art.dialog.open(url, {width: 600, height: 400,lock:true,title:'字段编辑', ok:			    	function(){
			var d = this.iframe.contentWindow.document;
			var img_list = new Array();
			$(d).find("input[name='mimg_url[]']").each(function(index, element) {
                img_list.push("'"+$(this).val()+"'");
            });
			var imgcate_id = $(d).find("#imgcate_id").val();
			$.post('{:U('insert')}',{img_list:img_list.toString(),imgcate_id:imgcate_id},function(data){
				if(data=='OK'){
						window.location.href = url;
					}
			});
			return false;
		}});
	}
	
	

	

    // 在光标处插入字符串
    // myField    文本框对象
    // 要插入的值
    function insertAtCursor(myField, myValue) 
    {
        //IE support
        if (document.selection) 
        {
            myField.focus();
            sel            = document.selection.createRange();
            sel.text    = myValue;
            sel.select();
        }
        //MOZILLA/NETSCAPE support
        else if (myField.selectionStart || myField.selectionStart == '0') 
        {
            var startPos    = myField.selectionStart;
            var endPos        = myField.selectionEnd;
            // save scrollTop before insert
            var restoreTop    = myField.scrollTop;
            myField.value    = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
            if (restoreTop > 0)
            {
                // restore previous scrollTop
                myField.scrollTop = restoreTop;
            }
            myField.focus();
            myField.selectionStart    = startPos + myValue.length;
            myField.selectionEnd    = startPos + myValue.length;
        } else {
            myField.value += myValue;
            myField.focus();
        }
    }

</script>
  <style>
  	#replyList ul li{margin-top:5px; background:#eee; padding:8px; width:700px;}
	.delnews{display:block; width:30px; font-size:20px; height:30px; border-radius:15px; background:#f00; color:#fff; line-height:30px; text-align:center;}
	.setInte input{margin-bottom:5px;}
	#control{border-bottom:1px solid #558fca; margin-bottom:10px;}
		#control li{float:left; height:40px; line-height:40px; border:1px solid #558fca; border-bottom:none;}
		#control li a{padding:0px 8px;}
		#control li.cur{background:#558fca;}
		#control li.cur a{color:#fff; font-weight:bold;}
		.relateListdel{display:inline-block; width:20px; height:20px; text-align:center; font-size:18px; cursor:default;}
		.memberDataBox, .reviewerDataBox, .followerDataBox{float:none;}
  </style>

  <form class="checkoutform" action="{:U('update')}" method="post">

      <input type="hidden" name="id" value="{$info.id}" >

        
        
        
        
        <div class="row">
            <div class="col-sm-6"><div class="form-group">
          <label class="control-label">表单名称</label>
          <div>
            <input datatype="*" class="form-control" value="{$form.name}" name="name" type="text" id="name" size="70" >
          </div>
        </div></div>
            
            
            <div class="col-sm-6"><div class="form-group">
          <label class="control-label">表格分类</label>
          
          
          
         <div class="row">
             <div class="col-sm-6" id="categoryBox">
                 <select class="form-control" datatype="*" name="formcategory_id" id="formcategory_id">
          <option value="">请选择</option>
          <volist name="formcategory" id="vo">
           
            <option <eq name="vo['id']" value="$form['formcategory_id']">selected="selected"</eq> value="{$vo.id}">{$vo.name}</option>
          </volist>
        </select>
             </div>
             <div class="col-sm-6">
                 <a width="300" rel="<?php echo U('Formcategory/add');?>" id="categoryBoxaddbtn" title="新增分类" class="btn btn-success" href="javascript:void(0);">新增分类</a>
             </div>
         </div>
          
          
          
          
          
          
         
        </div></div>
        
        
        </div>
         
        
        
        
        <div class="form-group">
          <label class="control-label">积分变动类型名称</label>
          <div>
            <input datatype="*" class="form-control" value="{$form.title}" name="title" type="text" id="title" size="70" >
          </div>
        </div>
        
        
        
        
        
        
        
        
        
        
        
        
        
        
         
        <div class="form-group">
         <a style="margin:5px;" href="##" rel="{:U('Field/add', array('formId' => $_GET['id']))}" title="新增字段" width="800" class="btn btn-success" id="ajaxloadfieldboxaddbtn">新增字段</a>
          <div id="ajaxloadfieldbox">
            
            
          </div>
          
          
          
        </div>
        
        
        <div class="form-group">

          <div><script id="template" class="ueditorelement" name="template" type="text/plain" style="height:500px; width:100%;">{$form.template}</script>
            <!--<html:editor id="template" name="template" type="UEDIT" style="height:400px; width:100%;"></html:editor>-->
          </div>
        </div>
        
        <div class="form-group setInte">
          <label class="control-label">积分因数</label>
          <div>
          <div class="InteType"><input id="{$vo.id}" onclick="insertAtCursor(document.getElementById('formula'),'approver');" value="审批人" class="btn btn-info btn-sm" type="button"/><input id="{$vo.id}" onclick="insertAtCursor(document.getElementById('formula'),'approver_id');" value="默认审批人" class="btn btn-info btn-sm" type="button"/><input id="{$vo.id}" onclick="insertAtCursor(document.getElementById('formula'),'proposer');" value="提交人" class="btn btn-info btn-sm" type="button"/><input id="{$vo.id}" onclick="insertAtCursor(document.getElementById('formula'),'{<?php echo '$rule';?>}');" value="系统积分规则" class="btn btn-info btn-sm" type="button"/></div>
          
          <!-- 积分类型 -->
          
         <div class="InteType"><volist name="InteType" id="vo">
          
          
          
          
          
              <input id="{$vo.id}" onclick="insertAtCursor(document.getElementById('formula'),'{$vo.typename}');" value="{$vo.remark}" class="btn btn-info btn-sm" type="button"/>
              
              
              
              
              
              
          </volist></div>
          <!-- 积分类型结束  -->
            <div id="ajaxloadfieldbox1"></div>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label">积分公式</label>
          
          
          
          
          <div>
            <p>运算符（格式：人员:积分类型="公式"）</p>
            
            
            
            
            
            
            
            
            
            <textarea name="formula" id="formula" class="form-control" style="height:200px;">{$info.formula}</textarea>
          </div>
        </div>
        
        
        
        <div class="form-group">
          
          <div>
            <html:listselect class="btn btn-sm btn-success" selected="form['rule']" name="rule" multiple="1" url="{:U('Integral_rule/select')}" title="选择积分规则" />
          </div>
        </div>
        <div class="form-group">
           
          <div>
            <html:listselect class="btn btn-sm btn-success" selected="form['approver']" name="member" multiple="1" url="{:U('Member/selectText')}" title="选择审核人" />
          </div>
        </div>
        <div class="form-group">
          <label class="control-label">规则操作方式</label>
          <div> 
            
            <!-- 0用户领取，1自动分发（此时需要周期） -->
            
            <label class="checkbox-inline"> <input name="rulecheck" type="radio" value="0" 
              
              <eq name="info['rulecheck']" value="0">checked="checked"</eq>
              />
              单选</label>
            <label class="checkbox-inline"> <input name="rulecheck" type="radio" value="1" 
              
              <eq name="info['rulecheck']" value="1">checked="checked"</eq>
              />
              多选</label>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label">分发方式</label>
          <div> 
            
            <!-- 0用户领取，1自动分发（此时需要周期） -->
            
            <label class="checkbox-inline"> <input name="handtype" type="radio" value="0" 
              
              <eq name="info['handtype']" value="0">checked="checked"</eq>
              />
              用户领取</label>
            <label class="checkbox-inline"> <input name="handtype" type="radio" value="1" 
              
              <eq name="info['handtype']" value="1">checked="checked"</eq>
              />
              自动分发</label>
          </div>
        </div>
        
        
        

  </form>
 <div id="categoryBoxpages">
</div>

<form id="categoryBoxform" action="{:U('Formcategory/getcategory')}">
</form>

<div id="ajaxloadfieldboxpages"></div>
<form action="{:U('Field/fieldlist', array('form_id' => $_GET['id']))}" id="ajaxloadfieldboxform"></form>

<div id="ajaxloadfieldbox1pages"></div>
<form action="{:U('Field/fieldlist1', array('form_id' => $_GET['id']))}" id="ajaxloadfieldbox1form"></form>


<style>
    .InteType input{margin:5px;}
</style>






<script>
    $('#categoryBox').ajaxlist({autoload:false});
	$('#ajaxloadfieldbox').ajaxlist({autoload:true, nodata:'<div style="padding:5px; text-align:center;">暂无字段</div>', success:function(){
		$('#ajaxloadfieldbox1form').submit();
	}}); 
	$('#ajaxloadfieldbox1').ajaxlist({autoload:false, nodata:'暂无字段'});
	UE.getEditor("template",{
		
		
		
		
		toolbars: [[
             'undo', 'redo', '|',
            'bold', 'italic', 'underline', 'fontborder', 'removeformat','inserttable','deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols','fullscreen'
        ]],
		
		
		
		
		serverUrl:"/13/Intesys/Ueditor/upload.html"});
	$(window).trigger('load');
</script>




